<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>评论列表</title>
  <link rel="stylesheet" href="./libs/bootstrap/css/bootstrap.min.css">
  <link rel="stylesheet" href="css/reset.css">
  <link rel="stylesheet" href="css/iconfont.css">
  <link rel="stylesheet" href="css/main.css">
  <script src="./libs/jquery-1.12.4.min.js"></script>
  <script src="./libs/template-web.js"></script>
  <script src="./libs/bootstrappaginator/bootstrap-paginator.min.js"></script>
  <script src="./js/http.js"></script>
  <script src="./js/comment_list.js"></script>
</head>

<body>
  <div class="container-fluid">
    <div class="common_title">
      评论列表
    </div>
    <div class="container-fluid common_con">
      <table class="table table-striped table-bordered table-hover mp20">
        <thead>
          <tr>
            <th>作者</th>
            <th>评论</th>
            <th>评论在</th>
            <th>提交于</th>
            <th>状态</th>
            <th class="text-center" width="100">操作</th>
          </tr>
        </thead>
        <tbody>

        </tbody>
      </table>
      <div class="row text-center">
        <select class="form-control currentOpt" style="float: left;width: 150px;">
          <option value="10">每页显示10条</option>
          <option value="20"> 每页显示20条</option>
          <option value="50">每页显示50条</option>
          <option value="100">每页显示100条</option>
        </select>
        <ul class="pagination pagination-sm" style="float: left;">

        </ul>
        <ul id="pagination" class="pagination-sm"></ul>
      </div>

    </div>
  </div>

  <script type="text/html" id="commentTemp">
    {{each data}}
    <!-- if判断必须需要/if结尾,中间可以接else & else if -->
    {{if $value.state == '待审核'}}
    <tr class="danger">
      {{else}}
      <tr>
    {{/if}}
      <td>{{$value.author}}</td>
      <td>{{$value.content}}</td>
      <td>{{$value.title}}</td>
      <td>{{$value.time}}</td>
      <td>{{$value.state}}</td>
      {{if $value.state == '待审核'}}
      <td class="text-center">
        <a href="javascript:void(0);;" class="btn btn-info btn-xs" data-id='{{$value.id}}'>批准</a>
        <a href="javascript:void(0);;" class="btn btn-danger btn-xs" data-id='{{$value.id}}'>删除</a>
      </td>
      {{else if $value.state == '已拒绝' }}
      <td class="text-center">
        <a href="javascript:editTr( 'trashed',10 );" class="btn btn-danger btn-xs" data-id='{{$value.id}}'>删除</a>
      </td>
      {{else}}
      <td class="text-center">
        <a href="javascript:void(0);;" class="btn btn-warning btn-xs" data-id='{{$value.id}}'>拒绝</a>
        <a href="javascript:void(0);;" class="btn btn-danger btn-xs" data-id='{{$value.id}}'>删除</a>
      </td>
      {{/if}}
    </tr>
    {{/each}}
  </script>
</body>

</html>